/**
 * Created by shitao on 15/10/17.
 */
(function () {

    // 创建angular工厂对象
    angular.module('my-tabs.apis')
        .factory('exploreApi', exploreApi);
    // 申明依赖
    exploreApi.$inject = ['api', '$http'];

    /**
     * 用户接口。
     *
     * @param api 对象，数据接口URL
     * @returns 对象，用户接口
     */
    function exploreApi(api, $http) {

        var exploreApi = {
            getCategories: getCategories,
            getPromotions: getPromotions,
            getStores: getStores
        }

        function getCategories() {
            return $http.get(api.CATEGORIES);
        };

        function getPromotions() {
            return $http.get(api.PROMOTIONS);
        };

        function getStores() {
            return $http.get(api.STORES);
        };

        return exploreApi;
    };
})();
